package com.breadenglish.cms.api.app.gateway.util;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by xull on 2015/8/17.
 */
public class CustomDateSerializer extends JsonSerializer<Date> {

    public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");

    @Override
    public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
        jgen.writeString(sdf.format(value));
    }
}
